import Vue from 'vue'
import Router from 'vue-router'
import options from "./routerOptions";
import store from "@/store";
import api from "@/api/api";

Vue.use(Router)

const router = new Router(options)
// 导航守卫
router.beforeEach((to, from, next) => {
  let accountInfo = sessionStorage.getItem("accountInfo");
  // if (to.path == '/login' && !to.needLogin) {
  //   if (accountInfo) {
  //     next({path: '/'})
  //   } else {
  //     next()
  //   }
  // } else {
  //   if (!accountInfo) {
  //     next({
  //       path: '/login',
  //       query: {redirect: to.path}
  //     })
  //   } else {
      next()
    // }
  // }
})


export default router;
